<?php
include('top.php');
require_once('pasmy/dbwaarden.php');
/*echo "dbhost = $dbhost<br>";*/
echo "<br><br>";
$mysql_id = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($db, $mysql_id);
if(isset($_POST["toevoegen"])){
	//echo "toevoegen<br>";
	addslashes($_POST["naam"]);if(empty($_POST["naam"])){$_POST["naam"]="&nbsp;";}
	addslashes($_POST["voornaam"]);if(empty($_POST["voornaam"])){$_POST["voornaam"]="&nbsp;";}
	addslashes($_POST["firma"]);if(empty($_POST["firma"])){$_POST["firma"]="&nbsp;";}
	addslashes($_POST["telefoon"]);if(empty($_POST["telefoon"])){$_POST["telefoon"]="&nbsp;";}
	addslashes($_POST["fax"]);if(empty($_POST["fax"])){$_POST["fax"]="&nbsp;";}
	addslashes($_POST["opmerkingen"]);if(empty($_POST["opmerkingen"])){$_POST["opmerkingen"]="&nbsp;";}
	
	
	
	
	$sql = "update contacten set naam='$_POST[naam]',voornaam='$_POST[voornaam]',firma='$_POST[firma]',tel='$_POST[telefoon]',Email='$_POST[email]',fax='$_POST[fax]',opm='$_POST[opmerkingen]' 
	where id = '$_POST[id]'";
	//echo "sql = $sql<br>";
	
	$res = mysql_query($sql, $mysql_id);
	
	echo "<div style='text-align: center'><h2>$updbdone[$taal]</h2></div>";
	
	
}
else {
if(isset($_GET["record"])){
 //echo "Jaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!<br>";
 $sql = "select * from contacten where id = '$_GET[record]'";
 //echo "sql = $sql<br>";
 $res = mysql_query($sql, $mysql_id);
 while ($row = mysql_fetch_row($res)) {
	$naampie = $row[0];
	$voornaampie = $row[1];
	$firmapie = $row[2];
	$telpie = $row[3];
	$faxpie = $row[4];
	$opmpie = $row[5];
	$emailpie = $row[6];
	$idpie = $row[9];
	}
}
?>
<form action="contactwijzigen.php" method="post">
<table>
<tr>
<td class="zones"><?php echo $naam[$taal];?></td>
<td class="zones"><input type="text" name="naam" size="25" maxlength="25" value="<?php echo $naampie;?>" /></td>
</tr>
<tr>
<td class="zones"><?php echo $voornaam[$taal];?></td>
<td class="zones"><input type="text" name="voornaam" size="25" maxlength="25" value="<?php echo $voornaampie;?>"/></td>
</tr>
<tr>
<td class="zones"><?php echo $firma[$taal];?></td>
<td class="zones"><input type="text" name="firma" size="25" maxlength="80" value="<?php echo $firmapie;?>" /></td>
</tr>
<tr>
<td class="zones">E-mail</td>
<td class="zones"><input type="text" name="email" size="25" maxlength="80"  value="<?php echo $emailpie;?>"/></td>
</tr>
<tr>
<td class="zones"><?php echo $telefoon[$taal];?></td>
<td class="zones"><input type="text" name="telefoon" size="25" maxlength="25" value="<?php echo $telpie;?>" /></td>
</tr>
<tr>
<td class="zones">Fax</td>
<td class="zones"><input type="text" name="fax" size="25" maxlength="80"  value="<?php echo $faxpie;?>"/></td>
</tr>
<tr>
<td class="zones"><?php echo $opmerkingen[$taal];?></td>
<td class="zones"><textarea name="opmerkingen" rows="10" cols="80"><?php echo $opmpie;?></textarea></td>
</tr>
<tr>
<td class="zones"><?php echo $land[$taal];?><input type="hidden" name="id" value="<?php echo $idpie;?>" /></td>
<td>
 &nbsp;
</td>
</tr>
<tr>
<td colspan="2"><div style="text-align: center"><input type="submit" name="toevoegen" value="<?php echo $updb[$taal];?>" /></div></td>
</tr>
</table>
</form>











<?php
}
include('footer.php');
?>